package xyz.imeans.w.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.imeans.w.config.ObjCreateFactory;
import xyz.imeans.w.model.TestDTO;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/{cnt}")
    public List<Map<String, Object>> test(@PathVariable Integer cnt) throws ClassNotFoundException {
        List<Map<String, Object>> l = new ArrayList<>(cnt);
        for (int i = 0; i < cnt; i++) {
            Map<String, Object> map = ObjCreateFactory.createObj(TestDTO.class);
            l.add(map);
        }
        return l;
    }
}
